{% extends 'base.html' %}

{% block breadcrumb_current %}
    设备管理 > 设备变更记录
{% endblock %}

{% block content %}
<div class="bg-light p-3 shadow-sm">
    <h5 style="color: #417690;">
        编号为{{ histories.first.number }}的设备调整变更记录
        <a href="{% url 'device_list' %}" class="btn btn-secondary btn-sm float-end">返回设备列表</a>
    </h5>
</div>

<div class="container mt-4">
    <table class="table table-hover">
        <thead>
            <tr>
                <th>位置变化</th>
                <th>故障状态变化</th>
                <th>变更理由</th>
                <th>客户代号</th>
                <th>客户名称</th>
                <th>申请日期</th>
                <th>审批结果</th>
                <th>操作人</th>
                <th>审批人</th>
                <th>审批日期</th>
            </tr>
        </thead>
        <tbody>
            {% for history in histories %}
            <tr class="custom-row-color">
                <td>{{ history.placebefore.place }} > {{ history.placenow.place }}</td>
                <td>{{ history.get_statebefore_display }} > {{ history.get_statenow_display }}</td>
                <td>{{ history.reason }}</td>
                <td>{{ history.cust_code }}</td>
                <td>{{ history.cust_name }}</td>
                <td>{{ history.create_date|date:"Y-m-d" }}</td>
                <td>{{ history.get_approvalstatus_display }}</td>
                <td>{{ history.operator.realname }}</td>
                <td>{{ history.approver.realname }}</td>
                <td>{{ history.approval_date|date:"Y-m-d" }}</td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="11" class="text-center">暂无变更记录</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}